//
//  MLAMessageDetailVC.m
//  MagicLampApp
//
//  Created by Zheng on 2018/12/19.
//  Copyright © 2018 zheng.magic.lamp.app. All rights reserved.
//

#import "MLAMessageDetailVC.h"
#import "MLAMessageModel.h"

@interface MLAMessageDetailVC ()

@end

@implementation MLAMessageDetailVC {
    UILabel *dateLbl;
    UILabel *detailLbl;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self configTitle:@"消息详情"];
    
    [self loadData];
}

- (void)loadData {
    NSDictionary *params = @{@"id":_modelId};
    [MLAHttpManage postHostType:MLAHttpHostType_Api api:kMessageDetail params:params success:^(id  _Nonnull response, NSString * _Nonnull msg) {
        [self configSubviews:[MLAMessageModel mj_objectWithKeyValues:response]];
    } failure:^{
        
    }];
}

- (void)configSubviews:(MLAMessageModel *)model {
    UILabel *titleLbl = [[UILabel alloc] init];
    titleLbl.font = CX_GetNormalFont(18);
    titleLbl.textColor = CX_GetColorTitle();
//    titleLbl.text = @"到期提示";
    titleLbl.text = model.title;
    [self.view addSubview:titleLbl];
    [titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.equalTo(self.titleView.mas_bottom).offset(20);
    }];
    
    dateLbl = [[UILabel alloc] init];
    dateLbl.font = CX_GetNormalFont(10);
    dateLbl.textColor = CX_GetColorHex(0x999999, 1);
//    dateLbl.text = @"2019-09-09";
    dateLbl.text = model.ctime;
    [self.view addSubview:dateLbl];
    [dateLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(titleLbl.mas_bottom).offset(11);
        make.left.mas_equalTo(15);
    }];
    
    detailLbl = [[UILabel alloc] init];
    detailLbl.frame = CGRectMake(15, 0, CX_GetScreenWidth()-30, 0);
    detailLbl.font = CX_GetNormalFont(12);
    detailLbl.textColor = CX_GetColorHex(0x6B7178, 1);
    detailLbl.numberOfLines = 0;
//    detailLbl.text = @"每次完成了一个项目，将自己的作品上传到各个平台或个人网站的时候，心里总会期待这么一幅愿景，作品获得了很多点击量，吸引了大量粉丝每次完成了一个项目，将自己的作品上传到各个平台或个人网站的时候，心里总会期待这么一幅愿景，作品获得了很多点击量，吸引了大量粉丝";
    detailLbl.text = model.content;
    [detailLbl sizeToFit];
    [self.view addSubview:detailLbl];
    [detailLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.top.equalTo(self->dateLbl.mas_bottom).offset(20);
        make.height.mas_equalTo(CGRectGetHeight(self->detailLbl.frame));
    }];
}

@end
